#include <iostream>
#include <vector>
using namespace std;

//5 2 3 4 6 1
int main()
{
	int n;
	cin>>n;
	vector<int> arr(n+1);
	for(int i=1;i<=n;i++)
		cin>>arr[i];
	int ret=0;
	bool flg=arr[1]<arr[2];
	vector<int> v;
	v.push_back(arr[1]);
	int pos=1;
	while(pos<=n)
	{
		if(pos==n)
		{
			ret++;
			break;
		}
		
		if(arr[pos]<arr[pos+1])
		{
			while(pos+1<=n && arr[pos]<=arr[pos+1])
				pos++;
			ret++;
		}
		else if(arr[pos]>arr[pos+1])
		{
			while(pos+1<=n && arr[pos]>=arr[pos+1])
				pos++;
			ret++;
		}
		else{
			while(pos+1<=n && arr[pos]==arr[pos+1])
				pos++;
		}
        pos++;
	}
	cout<<ret<<endl;
	return 0;
}
